How Indexed Pixels Work
How Indexed Pixels Work
Indexed devices expect that the pixel maps pointed to by color grafPort and
graphics device records are based on an indexed pixel system, in which the
stored image values are indexes to a table, not the RGB values themselves.
The indexed pixel path
As illustrated in the figure above, the user tells the application to choose a
color for some object (1). The application calls the
Color Picker (2), which offers its color wheel dialog box to the user (3),
who selects a color. The Color Picker returns that color to the application as a
full 48-bit RGB value (4). The application tells Color QuickDraw to draw
the object in that color (5). Color QuickDraw asks the Color Manager to
determine what color in the card's color table comes closest to the color
requested (6).
At startup, the video card's declaration ROM supplied information for the
creation of a graphics device record for the card, describing its
characteristics. The resulting graphics device record contains a color table
that is kept synchronized with the card's CLUT. The Color Manager need only
look into the current graphics device record's inverse table to find what RGB
colors are currently available (7) and decide which comes closest in RGB
space to the color requested by the application. (The inverse table is described
in the Color Manager) The Color Manager gets the index value for the best
match in the table and returns that value to
Color QuickDraw (8), which puts the index value into those places in video
RAM that store the object (9).
The card continuously displays video RAM by taking the index values,
converting them to RGB colors according to the CLUT entry at that index (10),
and sending them to digital-to-analog converters (11) that produce a signal
for the screen (12).